#include <stdio.h>
#include <string.h>

#include "..//include//fileOperations.h"

int checkValidity_file(char *s){ // 0 ----> Valid; 1 ----> Invalid

	
	int i;
	int flag = 0;
	int flag_ext = 1;
	
	for(i=0; i<strlen(s); i++){
		if(!isalnum(s[i])){
			if(s[i]!='.'){
				flag = 1;
				break;
			}
		}
		
		if(s[i]=='.') flag_ext = 0;
	}
	
	if (flag_ext == 1) return 1; // 1 indicates that the filename entered doesn't have an extension, hence unable to create a new file
	
	return flag;
	
}

int checkValidity_folder(char *s){ // 0 ----> Valid; 1 ----> Invalid

	
	int i;
	int flag = 0;
	int flag_ext = 0;
	
	for(i=0; i<strlen(s); i++){
		if(!isalnum(s[i]) || s[i]=='.'){			
			flag = 1;
			break;			
		}
		
		
	}
	
	return flag;
	
}

/*		
int main(){

	int flag;
	flag = checkValidity_file("as3.txt");
	
	if(flag==0) printf("String is valid\n");
	else if(flag == -1) printf("Extension of file not specified\n");
	else printf("String is not valid\n");
	
	return 0;
}
*/
